package lib.paxos;

import java.io.Serializable;

import lib.ArgumentValidator;
import lib.Command;

/**
 * Information about a Paxos round
 * @author abhip
 *
 */
public class RoundInfo implements Serializable
{
    /**
     * serialVersionUID is a universal version identifier for a Serializable
     * class. Deserialization uses this number to ensure that a loaded class
     * corresponds exactly to a serialized object. If no match is found during
     * deserialization, an InvalidClassException is thrown.
     */
	private static final long serialVersionUID = -1686990821951026209L;
	private Command command;
    private int roundID;

    public RoundInfo(int roundID, Command command)
    {
        ArgumentValidator.IsGreaterThanOrEqualTo("roundID", roundID, 0);
        ArgumentValidator.IsNotNull("command", command);

        this.roundID = roundID;
        this.command = command;
    }

    public Command Command()
    {
        return command;
    }

    public int RoundID()
    {
        return roundID;
    }

    @Override
    public String toString()
    {
        return String.format("roundID:%d, command:%s", roundID, command.toString());
    }
}
